<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=utf-8" import="com.*"%>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	    <title>照片删除</title>
	    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	    
	    <script src="${pageContext.request.contextPath }/scripts/boot.js" type="text/javascript"></script>
	    <style type="text/css">
    	
	    </style> 
  </head>
  
  <body>
   <form id="form1" method="post">
 	 <!-- ============================== 第一部分 制卡界面信息================================================== -->
 	 <fieldset style="border:solid 1px #aaa;width:95%;height: 100%;align:center;" >
 	 	<legend><span>照片删除</span></legend>
 	    <div style="width:100%;">
 	    	<table style="width:100%;" cellpadding="10">
 	    		<tr style="width:100%;">
 	    			<td style="width:60%;">
 	    				<table style="width:100%;">
 	    					<tr>
 	    						<td style="text-align:right;white-space: nowrap;">社会保障卡号:</td>
 	    						<td><input id="aac001" name="aac001" class="mini-textbox" emptyText="请输入社会保障卡号" vtype="int;minLength:10" maxlength="10" onenter="onKeyEnter"  style="width:100%;" required="true" /></td>
 	    					</tr>
 	    					<tr>
 	    						<td style="text-align:right;white-space: nowrap;">姓名:</td>
 	    						<td><input id="aac003" name="aac003" class="mini-textbox"  style="width:100%;" inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"/></td>
 	    					</tr>
 	    					<tr>
 	    						<td style="text-align:right;white-space: nowrap;">性别:</td>
 	    						<td><input id="aac004" name="aac004" class="mini-combobox"  style="width:100%;"  inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"
 	    						url="${pageContext.request.contextPath }/make.do?method=getaac004&lx=AAC004" valueField="aaa102" textField="aaa103"/></td>
 	    					</tr>
 	    					<tr>
 	    						<td style="text-align:right;white-space: nowrap;">民族:</td>
 	    						<td><input id="aac005" name="aac005" class="mini-combobox" style="width:100%;" inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"
 	    						url="${pageContext.request.contextPath }/make.do?method=getaac005&lx=AAC005" valueField="aaa102" textField="aaa103"/></td>
 	    					</tr>
 	    					<tr>
 	    						<td style="text-align:right;white-space: nowrap;">出生日期:</td>
 	    						<td><input id="aac006" name="aac006" class="mini-datepicker" style="width:100%;" inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"/></td>
 	    					</tr>
 	    					<tr>
 	    						<td style="text-align:right;white-space: nowrap;">身份证号:</td>
 	    						<td><input id="aac002" name="aac002" class="mini-textbox" style="width:100%;" inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"/></td>
 	    					</tr>
 	    				</table>
 	    			</td>
 	    			<td style="width:40%;">
 	    				<div id="pic" align="center" style="height:100%;background-color:rgb(241,241,243);">
                        <img src="" id="img0" style="height:200px;width:150px"/></div>
 	    			</td>
 	    		</tr>
 	    	</table>
 	    </div>
 	 </fieldset>
 	
 	 <!-- ============================== 第三部分 按钮================================================== -->
 	 <br/>
	    <div>
	    	<table style="table-layout:fixed;width:100%;" cellpadding="0" cellspacing="10">
	    		<tr style="width:100%;">
	    		 <td style="width:44%;white-space:nowrap;"></td>
			     <td style="width:6%;white-space:nowrap;"><a class="mini-button" id="onoks" onclick="onOk" enabled="false"  style="width:100%;" iconCls="icon-ok">确认</td>
			     <td style="width:6%;white-space:nowrap;"><a class="mini-button" onclick="onReset" style="width:100%;" iconCls="icon-remove">重置</td>
			     <td style="width:44%;"></td>
	    		</tr>
	    	</table>
	    </div> 
   </form> 
   
   <script type="text/javascript">
   		mini.parse();
   		var form = new mini.Form("form1");
   		function onKeyEnter()
        {
          var aac001 = mini.getbyName("aac001").getValue().trim();                     
           $.ajax({               
                    url: "/sbk/zpsc.do?method=checkgrzp",
                    cache: false,
                    data:{id:aac001},
                    success: function (text) {    
                             if("0"==text) {
                               mini.alert("无此人照片信息");
                               return;
                             }  
                             else
                             {
                                 showdate();
                             }                    
                    }
                });        
        }
        
        function showdate() {
           var aac001 = mini.getbyName("aac001").getValue().trim();                     
           $.ajax({               
                    url: "/sbk/zpsc.do?method=getgrunitdata",
                    cache: false,
                    data:{id:aac001},
                    success: function (text) {  
                    var msg=text.substring(11,text.length-2);
                    	if(msg.length==10){
                    		mini.alert("该社会保障卡号照片不可删除！");
                    		
                    		return;
                    	}
                        if(text == "null") 
                        {
                           mini.alert("该社会保障卡号尚未采集照片！")
                           return;
                        } 
                         mini.get("onoks").setEnabled(true);         
                       var o = mini.decode(text);                                            
                       form.setData(o);  
                       $("#img0").attr("src", "${pageContext.request.contextPath}/Picture/"+aac001+".JPG") ;                                  
                    }
                });        
        }
   		
   		function onOk()
   		{
           form.validate();
           if (form.isValid() == false) return;
           var aac001 = mini.getbyName("aac001").getValue().trim();    
           if(form.isValid()==true) {
      	   mini.mask({el: document.body,cls: 'mini-mask-loading',html: '删除中...'});
      	   }
   		   $.ajax({               
                    url: "/sbk/zpsc.do?method=deletedata",
                    cache: false,
                    data:{id:aac001},
                    success: function (text) {                    
                    if(text == "0")
                    {  
                       mini.unmask();                    
                       mini.alert("删除成功");  
                       form.setEnabled(false); 
                        mini.get("onoks").setEnabled(false);                   
                    } 
                    else
                    {
                      mini.unmask(); 
                      mini.alert("删除失败");
                    }  
                    //self.location.reload();                          
                    }
                });        
   		}
   		
   		 function onReset(e) {
			form.reset();
			mini.get("aac001").setEnabled(true); 
		    $("#img0").attr("src", "");
	}
   </script>
  </body>
</html>
